Skip to content

feat(lint): add PowerShell + Markdown anchor rules to ADR-007 layer (Bundle 1)#91

Merged
aloekun merged 4 commits intomasterfrom
feat-lint-rules-bundle1
Apr 29, 2026
Merged

feat(lint): add PowerShell + Markdown anchor rules to ADR-007 layer (Bundle 1)#91
aloekun merged 4 commits intomasterfrom
feat-lint-rules-bundle1

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented Apr 29, 2026

Summary

post-merge-feedback ループ収束のための Bundle 戦略 第 1 弾。旧順位 3 (PowerShell catch{} swallow, PR #85 T1-2) と旧順位 7 (Markdown 非 ASCII anchor, PR #89 T1-1) を 1 PR に統合し、ADR-007 既存基盤に 3 lint rule を追加。

背景: Bundle 戦略の動機

post-merge-feedback の自動起動が回り出した結果、1 task = 1 PR = N 件の新フィードバック発生という線形増加でループが収束しなかった。同一機構 (custom-lint-rules.toml への regex 追加) を共有するタスクをバンドル化することで PR 数を削減し、累積フィードバックを鈍化させる。

詳細議論: .claude/feedback-reports/90.md の議論ターン (Bundle 提案セクション)。

変更内容

1. 新規 lint rule (.claude/custom-lint-rules.toml)

Rule ID severity extensions 検出対象
no-empty-powershell-catch error ps1 catch {} ブロック (swallowed error)
no-silent-error-action warning ps1 -ErrorAction SilentlyContinue
no-mutable-anchor warning md Markdown link の non-ASCII GFM fragment

2. Unit test (src/hooks-post-tool-linter/src/main.rs)

13 test 追加。no-mutable-anchor の 4 edge case (path 空 + non-ASCII fragment / path あり + non-ASCII fragment / ASCII fragment / fragment なし) を全網羅。

3. Task entry 整理

  • docs/todo2.md: 旧順位 3 entry 削除
  • docs/todo3.md: 旧順位 7 entry 削除
  • docs/todo.md: summary table 27 → 25 行に renumber、Tier breakdown と関連参照を全更新

設計判断

Spec との trade-off (#3)

旧 task spec の「片方単独 warning / 組合せで error」は engine の per-line 設計で実現できないため、severity を rule 別に分離 (empty catch=error / SilentlyContinue=warning) で精神を保つ。両方検出されると 2 件出力されるので組合せの危険性は変わらず伝わる。

ADR-007 Q2 trade-off (#7)

no-mutable-anchor は Rust regex の lookbehind 非対応のため backtick 内 inline code を誤検出する。MVP として regex 層採用、説明文書での例は heading 自体を ASCII にして回避。

Bundle 1 から #4 を除外した経緯

初稿では Bundle 1 = 順位 3 + 4 + 7 を提案したが、task description の精読で順位 4 (Polling anti-pattern) は PreToolUse hook + Bash tool call 系列文脈 が必要 = custom-lint-rules.toml では実装不可と判明。Bundle 1' = 3 + 7 にスコープ縮小。

Test plan

  • cargo test: 58 passed / 0 failed
  • dogfood: 各 rule で違反ファイルを作成 → hook 直接呼出しで検出確認
    • PowerShell empty catch → NO_EMPTY_POWERSHELL_CATCH (error)
    • PowerShell SilentlyContinue → NO_SILENT_ERROR_ACTION (warning)
    • Markdown non-ASCII anchor → NO_MUTABLE_ANCHOR (warning)
  • clean baseline: .md 内の non-ASCII anchor 違反 0 件、scripts/prepare-pr-body.ps1 も違反なし
  • takt pre-push-review: simplicity APPROVE / security APPROVE (両 facet)

期待される収束効果

指標 Before After
Tier 1 タスク数 8 6
全タスク数 27 25
想定 PR 数 (旧 #3 + #7) 2 1 (50% 削減)

次の Bundle 候補: Bundle 3 (Stop gate determinism: 順位 4 + 13 = lint:md 統合 + vitest 固定)。

Summary by CodeRabbit

  • 新機能

    • PowerShell の空の catch ブロック検出ルールを追加
    • PowerShell の -ErrorAction SilentlyContinue 検出ルールを追加
    • Markdown の非ASCII GFMアンカーリンク検出ルールを追加
  • 不具合修正

    • 複数行パターンの検出精度を向上、違反箇所の行番号報告を正確化
  • ドキュメント

    • 推奨実行順序と優先度を再編・更新
    • .failed リカバリーマーカーの自己文書化を追加/旧タスク記載を削除
  • テスト

    • 追加ルール向けのユニットテストを拡充し検証を強化

Bundle 1 (post-merge-feedback の旧順位 3 + 7 を 1 PR に統合):

- no-empty-powershell-catch (error): 空 `catch {}` ブロックでの swallowed error
  検出 (PR #85 T1-2 finding)
- no-silent-error-action (warning): `-ErrorAction SilentlyContinue` の検出
  (PR #85 T1-2 finding、片方単独 warning)
- no-mutable-anchor (warning): Markdown link の non-ASCII GFM fragment 検出
  (PR #89 T1-1 finding)

実装:
- .claude/custom-lint-rules.toml に 3 rule 追加
- src/hooks-post-tool-linter/src/main.rs に 13 unit test 追加
  (#7 の 4 edge case + ps1 / extension filter 全網羅)
- cargo test: 58 passed
- dogfood で 3 rule すべて発火確認

設計判断:
- ADR-007 既存 pattern (regex 層 / file 単位) に適合、ADR 更新不要
- #3 の "片方単独 warning / 組合せ error" spec は engine の per-line 設計で
  実現できないため、severity を rule 別に分離 (empty catch=error /
  SilentlyContinue=warning) で精神を保つ
- #7 は ADR-007 Q2 (string literal 誤検出) が borderline だが、MVP として
  regex 層採用。lookbehind 非対応のため backtick 内例は誤検出するが、
  task entry 削除で clean baseline 達成

Bundle 戦略 (post-merge-feedback ループ収束のため):
- 個別 PR なら 2 件 → 1 PR に統合 (50% 削減)
- summary table を 27 → 25 行に renumber、Tier breakdown 全更新

Closes feedback: PR #85 T1-2, PR #89 T1-1
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Warning

Rate limit exceeded

@aloekun has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 1 second before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d1a6599-642f-47c2-b080-a7c68e2ccb76

📥 Commits

Reviewing files that changed from the base of the PR and between ff7c64a and e69591f.

📒 Files selected for processing (2)
  • .claude/custom-lint-rules.toml
  • src/hooks-post-tool-linter/src/main.rs
📝 Walkthrough

Walkthrough

PowerShell と Markdown 向けの3つのカスタムリント規則を追加し、run_custom_rules の全ファイル正規表現マッチとバイトオフセット→行位置計算への変更を含む単体テスト群を追加。複数ドキュメントのタスク一覧を更新/整理した。

Changes

Cohort / File(s) Summary
カスタムリント規則定義
.claude/custom-lint-rules.toml
3件追加:no-empty-powershell-catch(空の catch {} をエラー検出)、no-silent-error-action-ErrorAction SilentlyContinue を警告)、no-mutable-anchor(非ASCII GFM アンカーフラグメントを警告)。各ルールにパターン、bad/good 例、修復指示を追加。
リンター本体 / 単体テスト
src/hooks-post-tool-linter/src/main.rs
run_custom_rules を行ごと検索からファイル全体の Regex::find_iter(&content) に変更し、マッチ開始バイト位置から行番号を算出するロジックへ更新。多様なケースを検証するフィクスチャベースの統合的単体テスト群(.ps1/.md 一時ファイル生成、拡張子スコープ・大文字小文字・複数マッチ確認)を追加。
タスク一覧更新
docs/todo.md
推奨実行順序表とTier割当を再編成(Bundle 1 後の順位体系へ反映)、rate-limit 設計位置の移動、完了タスク注記の追記等を実施。
タスク削除(文書)
docs/todo2.md
PowerShell の swallowed-error 検出タスク記述を削除(実装済みのため)。
タスク整理/新規タスク(文書)
docs/todo3.md
非ASCIIアンカー検出タスクを削除(実装済み)。.failed マーカーの自己文書化タスクを追加(テンプレ化された回復コマンド/失敗コンテキストの埋め込み仕様)。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRタイトル「feat(lint): add PowerShell + Markdown anchor rules to ADR-007 layer (Bundle 1)」は、変更内容の主要な部分を正確に反映している。PowerShell と Markdown の新しいリント規則をADR-007レイヤーに追加するというコア変更が明確に示されている。
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 45 minutes and 1 second.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/custom-lint-rules.toml:
- Around line 85-119: Update the two PowerShell rule patterns to be
case-insensitive so they catch variations like "Catch {}" and "-erroraction
silentlycontinue": modify the "no-empty-powershell-catch" pattern string to use
a case-insensitive regex (for example change 'catch\s*\{\s*\}' to
'(?i)catch\s*\{\s*\}') and modify the "no-silent-error-action" pattern to
'(?i)-ErrorAction\s+SilentlyContinue' (or a slightly more permissive
'(?i)-\s*erroraction\s+silentlycontinue') so the matcher no longer misses
different capitalizations; keep the same rule ids "no-empty-powershell-catch"
and "no-silent-error-action" when applying these edits.

In `@docs/todo.md`:
- Around line 47-53: The document's priority-count references are inconsistent
with the updated 25-item table; search docs/todo.md for remaining legacy strings
like "25/26", "26/26", "9/26" (examples called out in the review) and replace
them with the correct 25-based references (e.g., "25/25" or adjust the numerator
as appropriate), then scan for any other "/26" or "26" occurrences and update
them to match the new total, and run a quick read-through to ensure in-text
explanations (mentions of順位総数 or specific priority ranges) remain coherent after
the number changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 17f40563-c682-4842-bf32-803344a07081

📥 Commits

Reviewing files that changed from the base of the PR and between 9572335 and a71c054.

📒 Files selected for processing (5)
  • .claude/custom-lint-rules.toml
  • docs/todo.md
  • docs/todo2.md
  • docs/todo3.md
  • src/hooks-post-tool-linter/src/main.rs
💤 Files with no reviewable changes (1)
  • docs/todo2.md

Comment thread .claude/custom-lint-rules.toml
Comment thread docs/todo.md
PR #91 で受けた CodeRabbit findings 2 件を child commit として修正。

1. Major: PowerShell rule case-insensitivity (.claude/custom-lint-rules.toml:115-118)
   - PowerShell の `catch` keyword と `-ErrorAction` parameter は case-insensitive
     なので、`Catch {}` / `CATCH {}` / `-erroraction silentlycontinue` /
     `-ErrorAction SILENTLYCONTINUE` などの大文字バリアントは現 regex で見逃していた
   - 両 rule の pattern に Rust regex `(?i)` inline flag を追加して case-insensitive
     マッチに変更
   - test helper (ps_empty_catch_rule / ps_silent_error_rule) も同様に更新

2. Minor: docs/todo.md stale references (lines 68 / 250 / 264)
   - Bundle 1 の renumber (27 \u2192 25) で本文内の cross-reference が追従漏れ
   - line 68: `Tier 4 (順位 25/26)` \u2192 `24/25`
   - line 250: `Tier 5 (順位 26/26)` \u2192 `25/25`、`順位 25` \u2192 `順位 24`
   - line 264: `Tier 2 (順位 9/26)` \u2192 `7/25`、`順位 17 (ADR-032 PR-β)` \u2192 `順位 16`

実装 (TDD):
- 先に case-insensitive variant の 4 unit test を追加し、cargo test で FAIL を実証 (RED)
- (?i) flag 追加で GREEN \u2192 62 tests pass (旧 58 + 新 4)
- bad/good example も大文字混在ケースで影響なしを確認 (regex は (?i) 範囲)

順位 23 (todo.md 採番管理の簡素化 ADR 起案、PR #86 T3-3) で構造的解決予定。
本 fix は当面の対症療法として cross-ref を手作業で同期。
@aloekun
Copy link
Copy Markdown
Owner Author

aloekun commented Apr 29, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/hooks-post-tool-linter/src/main.rs`:
- Around line 1097-1142: The current empty-PowerShell-catch rule created by
ps_empty_catch_rule and exercised via run_custom_rules misses multi-line empty
blocks because the matcher is applied per-line; change the detection to run the
regex against the entire file content (not line-by-line) so patterns like "catch
{\n}" are matched, then convert the regex match.start()/match.end() offsets into
a line number/range for the violation (compute line by counting '\n' up to the
byte offset) so compile_test_rules/run_custom_rules will report the correct file
location; keep using the same regexp (e.g., (?i)catch\s*\{\s*\}) but apply it
over the whole source string and map match spans back to line positions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf5db3cc-743a-4252-af49-808f82c1f718

📥 Commits

Reviewing files that changed from the base of the PR and between a71c054 and a15b263.

📒 Files selected for processing (3)
  • .claude/custom-lint-rules.toml
  • docs/todo.md
  • src/hooks-post-tool-linter/src/main.rs

Comment thread src/hooks-post-tool-linter/src/main.rs
PR #91 の 2nd CodeRabbit review で指摘された Major finding を修正。

問題:
- run_custom_rules() が `for line in content.lines()` で行ごとに regex.find() を
  呼ぶ実装だったため、PowerShell 慣用形 `} catch {\n}` の複数行空ブロックが
  検出できなかった (no-empty-powershell-catch は error severity なのに false
  negative)。
- 既存パターン (console.log( / no-personal-paths / no-mutable-anchor 等) は
  すべて行内完結のため挙動変化なし。SilentlyContinue は \s+ で改行を跨ぎ得るが、
  PowerShell の backtick 行継続を含む正当な使用も検出対象として妥当。

修正:
- run_custom_rules() を file-level マッチに変更
  (`compiled.regex.find_iter(&content)` でファイル全体を走査)
- match の byte offset から改行カウントで line 番号を逆算
  (`content[..m.start()].bytes().filter(|b| *b == b'\n').count() + 1`)
- MAX_CUSTOM_VIOLATIONS の上限と既存テスト挙動はそのまま維持

実装 (TDD):
- ps_empty_catch_detects_multiline_block test を追加し RED 確認
  (既存実装で 0 件検出 → 1 件期待で FAIL)
- 修正後 GREEN \u2192 63 tests pass (旧 62 + 新 1)
@aloekun
Copy link
Copy Markdown
Owner Author

aloekun commented Apr 29, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/hooks-post-tool-linter/src/main.rs`:
- Around line 1267-1272: The current md_mutable_anchor_rule (created via
make_test_rule "no-mutable-anchor") matches anchors inside external URLs like
https://example.com/#日本語; change the regex to ignore absolute/external URLs by
adding a negative lookahead that rejects schemes and protocol-relative URLs
(e.g., (?![a-zA-Z][a-zA-Z0-9+.-]*://|//)) before the path capture so the rule
only fires for relative/GFM anchors, update md_mutable_anchor_rule to use that
revised pattern, and add a negative test case (e.g.,
`[link](https://example.com/#日本語)`) to the rule's test suite to prevent
regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7ba904ca-bdda-4ce8-becf-c658bd2e8b17

📥 Commits

Reviewing files that changed from the base of the PR and between a15b263 and ff7c64a.

📒 Files selected for processing (1)
  • src/hooks-post-tool-linter/src/main.rs

Comment thread src/hooks-post-tool-linter/src/main.rs
…lusion)

PR #91 の 3rd CodeRabbit review で指摘された Minor finding を修正。

問題:
- regex `\]\([^)#]*#[^\x00-\x7F)]+` は path 部に `:` を許容するため、
  `[link](https://example.com/#日本語)` のような外部 URL の fragment を
  GFM anchor と誤判定 (false positive)。
- 外部 URL の fragment は GFM anchor ではないため、warning rule の
  alert fatigue を招く。

修正:
- regex を `\]\([^)#:]*#[^\x00-\x7F)]+` に変更 (path 部から `:` を除外)。
  http(s):// を含む URL は path 部マッチで止まるため対象外になる。
- protocol-relative URL (`//example.com/...`) は `:` を含まないため除外
  できないが、Markdown 文書では稀なので許容。
- CodeRabbit 提案の negative lookahead は Rust regex 非対応なので、
  character class 否定 1 文字追加で同等効果を実現。

実装 (TDD):
- md_mutable_anchor_skips_external_url_with_fragment test を追加 → RED
  (`[spec](https://example.com/#日本語)` で 1 件検出 → 0 件期待で FAIL)
- pattern 修正後 GREEN \u2192 64 tests pass (旧 63 + 新 1)
@aloekun aloekun merged commit 9040d26 into master Apr 29, 2026
1 check passed
@aloekun aloekun deleted the feat-lint-rules-bundle1 branch April 29, 2026 08:38
aloekun added a commit that referenced this pull request Apr 29, 2026
PR #92 で受けた CodeRabbit Minor findings 2 件を child commit として修正。
両 finding は self-consistent: Finding 1 の改善 regex が Finding 2 の placeholder
残存を機械的に検出可能になる。

1. Minor: ADR-033 line 111 の検証 regex が数値以外の placeholder を見逃す
   - 旧: `順位 [0-9]+` (数値のみマッチ)
   - 新: `順位 [0-9A-Za-z_-]+` (英字 placeholder `順位 X` / `順位 N` も検出)
   - 期待コメントも更新し、placeholder 検出意図を明記

2. Minor: docs/todo3.md line 511 (REJECT-ESCALATE entry の動機セクション) で
   `.claude/ filter (順位 X = T2-1+T3-2 Bundle)` という placeholder が残存
   - 旧: `.claude/ filter (順位 X = T2-1+T3-2 Bundle)`
   - 新: `.claude/ filter + ADR-030 制約明記 task (PR #91 T2-1 + T3-2 Bundle)`
   - ADR-033 「本文はタスク名参照」方針に準拠

検証 (改善 regex で 0 件達成):
```sh
grep -nE "順位 [0-9A-Za-z_-]+" docs/todo.md docs/todo2.md docs/todo3.md   | grep -vE "推奨実行順序サマリー|^[^:]+:[0-9]+:\| [0-9]+ \|"
# 結果: 0 行
```
aloekun added a commit that referenced this pull request Apr 29, 2026
* feat(adr): ADR-033 todo numbering simplification (試験運用)

PR #85/#86/#88/#89/#90/#91/Bundle 1 で連続発生した renumber 作業の構造的負債を
解消する ADR を起案。

問題:
- docs/todo.md の本文中 `順位 N` cross-reference が線形コストで増加
- PR #91 では 4 件追加に対し本文 8 箇所修正、過去 PR で stale reference の
  追従漏れによる CodeRabbit Minor 指摘が発生 (a15b263 で修正)
- 採番のみが情報源で、本文と表の往復が発生

決定 (選択肢 B 採用):
- 絶対番号 (`順位 N`) は推奨実行順序サマリー table のみに保持
- 本文での参照は task 名 (heading text or 略称) で行う
- table の `依存` 列のみ絶対番号を許可 (table 内なので renumber 同期可能)
- 「Tier N (順位 X/Y)」表記の `(順位 X/Y)` 部分は除去 → `Tier N` のみ残す

却下した選択肢:
- 選択肢 A (renumber script の自動化): 保守コスト新規発生、問題のすり替え
- 選択肢 C (現状維持): convergence loop の一因、線形増加は止まらない

本 commit は ADR と CLAUDE.md リンク追加のみ。本文 cross-ref の一括変換と
新規 entry template は次の commit で実施。

References:
- docs/adr/adr-013, adr-022, adr-028
- .claude/feedback-reports/86.md Tier 3 #3 (起案動機の起源)
- PR #91 a15b263 (stale reference 起因の Minor 指摘実例)

* refactor(docs): remove inline rank references from todo files

ADR-033 のガイドライン適用。docs/todo.md / todo2.md / todo3.md の本文中
`順位 N` cross-reference をすべて task 名参照に変換。

変更対象:
- docs/todo.md: 戦略 section の 12 箇所、Tier 4/5 entry の (順位 X/Y) 表記、
  週次レビュー entry の cross-ref
- docs/todo2.md: ADR-032 series の Phase ごと優先度表記、reviewer facet /
  各 Tier 1/2/3 entry の (順位 X/Y) と inline 参照
- docs/todo3.md: Stop hook lint:md / AI 生成一時スクリプト / cli-pr-monitor
  polling 延長 / post-pr-review rate-limit / .failed marker / Recovery 経路 /
  REJECT-ESCALATE entry の inline 参照を全て task 名に変換

維持した absolute number:
- docs/todo.md の推奨実行順序サマリー table の `順位` 列 (source of truth)
- table の `依存` 列の絶対番号 (table 内なので renumber と同期可能)
- table 内 cell の歴史的 `旧順位 N` 表記 (完了済み task の参照)

未変換の例外:
- docs/todo2.md line 696 の採番管理 ADR 元 entry の `(順位 24/26)` は
  本 PR の Commit 3 で entry 全体を削除するため未変換 (削除待ち)

検証:
```sh
grep -nE '順位 [0-9]+' docs/todo.md docs/todo2.md docs/todo3.md
# 期待: docs/todo.md table 列のみ + docs/todo2.md 採番管理 ADR 元 entry のみ
```

References:
- docs/adr/adr-033-todo-numbering-simplification.md (本 ADR の決定)

* docs(todo): remove completed numbering simplification ADR entry

ADR-033 land により採番管理簡素化 task が完了したため、運用ルール
(memory feedback_todo_no_history.md) に従い元 entry を削除する。

変更:
- docs/todo2.md: "todo.md 採番管理の簡素化 ADR 起案 (PR #86 T3-3)" entry
  全体 (40 行) を削除
- docs/todo.md summary table:
  - 旧順位 27 (採番管理 ADR) 行を削除
  - 旧順位 28 (ADR-030 Phase E/F) → 順位 27 に renumber
  - 旧順位 29 (ADR-030 takt-test-vc) → 順位 28 に renumber、依存表記の
    `順位 28 Phase F` も `順位 27 Phase F` に追従
  - サマリー header 日付ラベルを "Bundle 1 完了後" → "ADR-033 land 後" に更新

検証:
- 本文 cross-ref は Commit 2 で除去済のため、本 commit の renumber は
  table 行と `依存` 列のみで完結 (ADR-033 の効果を本 PR 内で実証)
- markdownlint pass (PostToolUse hook で各 Edit ごとに検証)

* fix(adr): apply CodeRabbit findings on PR #92

PR #92 で受けた CodeRabbit Minor findings 2 件を child commit として修正。
両 finding は self-consistent: Finding 1 の改善 regex が Finding 2 の placeholder
残存を機械的に検出可能になる。

1. Minor: ADR-033 line 111 の検証 regex が数値以外の placeholder を見逃す
   - 旧: `順位 [0-9]+` (数値のみマッチ)
   - 新: `順位 [0-9A-Za-z_-]+` (英字 placeholder `順位 X` / `順位 N` も検出)
   - 期待コメントも更新し、placeholder 検出意図を明記

2. Minor: docs/todo3.md line 511 (REJECT-ESCALATE entry の動機セクション) で
   `.claude/ filter (順位 X = T2-1+T3-2 Bundle)` という placeholder が残存
   - 旧: `.claude/ filter (順位 X = T2-1+T3-2 Bundle)`
   - 新: `.claude/ filter + ADR-030 制約明記 task (PR #91 T2-1 + T3-2 Bundle)`
   - ADR-033 「本文はタスク名参照」方針に準拠

検証 (改善 regex で 0 件達成):
```sh
grep -nE "順位 [0-9A-Za-z_-]+" docs/todo.md docs/todo2.md docs/todo3.md   | grep -vE "推奨実行順序サマリー|^[^:]+:[0-9]+:\| [0-9]+ \|"
# 結果: 0 行
```
aloekun added a commit that referenced this pull request Apr 29, 2026
… 登録 (#95)

* feat(takt): Bundle T (reviewer facet 改善 + .claude/ filter) + Bundle U 登録

token 削減 Phase 2 (Bundle T) の本実装と、Bundle U の todo 登録を同梱する。
両者は token-reduction 系で論理的近接 + rate-limit 不安定期の PR 数最小化方針による同居。

## Bundle T 本実装 (順位 9 + 14)

### 順位 9: Reviewer facet 改善 (PR #82 T3-combined)

`.takt/facets/instructions/review-simplicity.md`:
- Scope of DRY / YAGNI セクション追加
- DRY 適用範囲: コードロジックのみ。docs 階層化や docs/code 重複は対象外
- YAGNI 適用範囲: 実装 only。"Phase 2 検討" 等の計画書記述は対象外

`.takt/facets/instructions/review-security.md`:
- Docs-only changes: trust boundary criterion セクション追加
- trust boundary 不変な docs 変更 (ポリシー説明・用語定義等) は APPROVE 即判定
- trust boundary 関連 (権限境界の再定義等) は通常 review

### 順位 14: post-pr-review fix loop の `.claude/` filter + ADR-030 制約明記

`.takt/facets/instructions/analyze-coderabbit.md`:
- Sensitive-file protection filter 追加 (`.claude/**` → `user_decision_path`)
- Scope mismatch を `.git/`, `.jj/`, `node_modules/`, `target/` まで拡張
- Verdict rule: `user_decision_path` は severity 問わず `user_decision` 経路へ
- Output Format に User Decision Path テーブル追加

`docs/adr/adr-030-deterministic-post-merge-feedback.md`:
- 「post-pr-review fix loop の対象外パス」セクション追加
- 3 カテゴリ documented: Claude sensitive-file / VCS 内部 / 依存物
- PR #91 で実証された 8 step 空費 pathological loop の採用根拠
- Verdict ルールの整合表と関連 ADR への参照

## Bundle U 登録 (順位 29 + 30)

`docs/todo.md`:
- 順位 29 (Tier 1): 非 docs ファイル `docs/todo` 参照検出 lint rule
- 順位 30 (Tier 3): Cross-File Reference Lifecycle ルールに具体例追記
- narrative に Bundle U 説明追加

`docs/todo3.md`: 上記 2 件の詳細エントリ追加

## todo cleanup

- todo.md table から順位 9, 14 削除
- todo2.md から順位 9 詳細削除
- todo3.md から順位 14 詳細削除
- 関連 narrative を完了状態に更新

## 期待効果

- false positive iteration 削減: docs PR で simplicity/security の DRY/YAGNI 誤検出ゼロ
- pathological loop 防止: `.claude/` 配下に finding が出る PR で 8 step 空費が再発しない
- review report の透明性向上: User Decision Path として明示分類

## 検証

- markdown lint: 全ファイル 0 errors
- jj diff --stat: 7 files changed
- 実装テスト: facet 変更は dogfood まで定量検証不能 (LLM 挙動)、初回適用 PR で観察

* fix(takt): CodeRabbit 指摘 2 件への対応 (PR #95)

Finding #1 (Major, analyze-coderabbit.md): Step 3 と新規 User Decision Path
テーブルの severity 列の整合性を解消。Step 3 を「Severity は CodeRabbit の
severity field から取得 (`applicable` と `user_decision_path` 共通)」に明記し、
理由 (user の優先度判断に有用) を補足。`not_applicable` は severity 不要と
明記。

Finding #2 (Minor, ADR-030 line 315): LanguageTool 文法指摘に従い
「設計。」を「設計である。」に変更 (DOUSI_DEHA rule)。

* fix(adr): ADR-030 と analyze-coderabbit.md の整合性を解消 (PR #95)

CodeRabbit 再レビューで検出された Major × 2 件への対応:

Finding A (line 286-287): 「すべての除外 path は user_decision_path」記述が
実装と乖離していた。実装では `.claude/**` のみ user_decision_path で、
VCS/依存物は not_applicable (別経路、Step 2 でフィルタ)。本 commit で
2 種類の分類を明示。前回 commit で Scope mismatch を 4 path に拡張した際の
ADR テキスト更新漏れの drift を解消。

Finding B (line 310-313): Verdict テーブルヘッダ「.claude/ etc. (対象外 path)」
が verdict routing に参加する全 path を示すよう誤読されるため、
「.claude/ (user_decision_path)」に変更。テーブル前に「verdict routing に
参加する applicable と user_decision_path のみを示す」注記を追加し、
not_applicable が verdict に関与しないことを明記。

両者とも CodeRabbit suggestion 準拠 (commit_id c983377 を root とする
分類整合性問題、本 commit で完全に整合)。

* fix(adr): ADR-030 line 325 の ADR-018 表記を 'cli-pr-monitor takt 移行' に統一 (PR #95)

CodeRabbit 再レビュー指摘 (Minor) への対応。本文 line 35 / References line 365
で既に 'cli-pr-monitor' 表記に統一されていたが、本 PR の前 commit で追加した
'関連 ADR' セクションのみ 'post-pr-monitor 移行' と誤記。post-pr-monitor は
workflow 名で ADR-018 の対象 tool ('cli-pr-monitor') と異なる概念のため事実誤認。
実 ADR-018 タイトル ('cli-pr-monitor の takt ベース移行と CronCreate 廃止') に
合わせて統一。
aloekun added a commit that referenced this pull request May 7, 2026
…P-1/P-2 ledger (順位 7 / §A-2 P-3) (#127)

* feat(hooks-post-tool-linter): PowerShell (?i) flag validation + §A-2 P-1/P-2 ledger 記録 (順位 7 / §A-2 P-3)

§A-2 Phase 5 dogfood P-3 (順位 7)。PR #91 で発覚した PowerShell case-insensitive
regex の構造的落とし穴 (no-empty-powershell-catch / no-silent-error-action で
(?i) 欠落 → CR Major 指摘) を機械強制で再発防止。

順位 7 (Tier 1, T1-1):
- find_powershell_rules_missing_case_insensitive_flag() 関数追加: extensions に
  ps1 を含む rule で pattern に (?i) が無いものを ID リストで返す
- load_custom_rules() で起動時 warn (本番運用層)
- 7 unit tests (異種 violator / valid / mixed-ext / case-insensitive ext /
  multi-violator / non-ps1 ignore) + 1 deployed-config 全 rule 検証 test (CI 検出層)
- 既存 no-ephemeral-todo-reference rule の pattern に (?i) を追加 (deployed
  validation を pass、Windows file path 大文字小文字混在対応の副次効果あり)
- ~/.claude/rules/common/code-review.md § Custom lint rule patterns 追加
  (PR #91 a15b263 fix の経緯 + 順位 7 機械強制の事後参照)

§A-2 計測ログ (P-1/P-2) 記録:
- P-1 (PR #125): findings: 0 (CR APPROVE no comments)、classifier 未起動 →
  dogfood 不発
- P-2 (PR #126): findings: 1 (CR Nitpick、review body <details> block 内、
  check-ci-coderabbit 抽出漏れ)、手動 synthetic finding で classifier 実行 →
  action=human_review / action_confidence=0.0 / fallback=length_contract、
  agreement: 1/1 (100%)、latency: 6.4s/件 (>5s 目標)、fallback: 1/1
- 既知 system gap: check-ci-coderabbit が review body の <details> Nitpick を
  抽出しない (post-pr-monitor が classifier に渡す入力経路に欠落)

build + deploy 済 (.claude/hooks-post-tool-linter.exe)。
全 82 tests pass、regression なし。

* docs(todo): 順位 7 (PowerShell (?i) flag 自動検証) 完了に伴い削除
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant